#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

"""
@author: JoeyZhou
@Tool: PyCharm
@Date: 2020/2/16 9:54 PM
@desc: 数据库连接封装
"""

import pymysql


class SqlBase:

    def mysql_connect(self):
        host = "localhost"
        user = "root"
        password = "123456"
        database = "aihuishou"
        # 连接database
        conn = pymysql.connect(host=host, user=user, password=password, database=database, charset="utf8")
        # 得到一个可以执行SQL语句的光标对象
        cur = conn.cursor()
        return cur, conn


if __name__ == '__main__':
    sb = SqlBase()
    print(sb.mysql_connect())


